package com.zxw.user.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.zxw.common.core.base.res.BaseRes;
import com.zxw.user.domain.dto.IdLabelDTO;
import com.zxw.user.domain.dto.MenuDTO;
import com.zxw.user.domain.entity.Menu;
import com.zxw.user.service.CompanyMenuService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Xuewei.Zhang
 * @since 2022-03-30
 */
@RestController
@RequestMapping("/company-menu")
@RequiredArgsConstructor
public class CompanyMenuController {

    private final CompanyMenuService companyMenuService;

    @ApiOperationSupport(author = "Xuewei.Zhang")
    @ApiOperation("获取菜单列表")
    @GetMapping("/menu-list")
    public BaseRes<List<MenuDTO>> menuList(Menu menu) {
        List<MenuDTO> menuList = companyMenuService.getMenuList(menu);
        return BaseRes.ok(menuList);
    }

    @ApiOperationSupport(author = "Xuewei.Zhang")
    @ApiOperation("获取菜单选择列表")
    @GetMapping("/menu-select-list")
    public BaseRes<List<IdLabelDTO>> menuSelectList(Menu menu) {
        List<IdLabelDTO> menuList = companyMenuService.getMenuSelectList(menu);
        return BaseRes.ok(menuList);
    }

}
